package com.yantong.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * 拼团产品类型
 *
 * @author liaozhaogui-773104632@qq.com
 * @date 2021/1/28 15:44
 */
public enum MarketingGroupTypeEnum {
	ORDINARY(0, "普通拼团"),
	GIFT_BAG(1, "大礼包拼团");

	private Integer code;
	private String msg;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}



	private static Map<Integer, String> all= new HashMap<>();
	static{
		for(MarketingGroupTypeEnum obj: EnumSet.allOf(MarketingGroupTypeEnum.class)){
			all.put(obj.code, obj.msg);
		}
	}
	public static String get(String code){
		return all.get(code);
	}
	public static Integer getCode(String msg){
		MarketingGroupTypeEnum[] values = MarketingGroupTypeEnum.values();
		for (MarketingGroupTypeEnum value : values) {
			if (value.getCode().equals(msg)){
				return value.getCode();
			}
		}
		return null;
	}

	MarketingGroupTypeEnum(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}
}
